home *** CD-ROM | disk | FTP | other *** search
Wrap
FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) NNNNAAAAMMMMEEEE fcntl - file and descriptor control CCCC SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<uuuunnnniiiissssttttdddd....hhhh>>>> ####iiiinnnncccclllluuuuddddeeee <<<<ffffccccnnnnttttllll....hhhh>>>> iiiinnnntttt ffffccccnnnnttttllll ((((iiiinnnntttt ffffiiiillllddddeeeessss,,,, iiiinnnntttt ccccmmmmdddd,,,, ............ ////**** aaaarrrrgggg ****////))));;;; DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN _f_c_n_t_l provides for control over open descriptors. _f_i_l_d_e_s is an open descriptor obtained from a _c_r_e_a_t, _o_p_e_n, _d_u_p, _f_c_n_t_l, _p_i_p_e, _s_o_c_k_e_t, or _s_o_c_k_e_t_p_a_i_r system call. The commands available are: FFFF____DDDDUUUUPPPPFFFFDDDD Return a new descriptor as follows: Lowest numbered available descriptor greater than or equal to the third argument, _a_r_g, taken as an object of type int. Refers to the same object as the original descriptor. Same file pointer as the original file (i.e., both file descriptors share one file pointer). Same access mode (read, write or read/write). Same descriptor status flags (i.e., both descriptors share the same status flags). Shares any locks associated with the original file descriptor. The close-on-exec flag, FFFFDDDD____CCCCLLLLOOOOEEEEXXXXEEEECCCC associated with the new descriptor is cleared to keep the file open across calls to the _e_x_e_c(2) family of functions. FFFF____GGGGEEEETTTTFFFFDDDD Get the file descriptor flags associated with the descriptor _f_i_l_d_e_s. If the FFFFDDDD____CCCCLLLLOOOOEEEEXXXXEEEECCCC flag is 0000 the descriptor will remain open across _e_x_e_c, otherwise the descriptor will be closed upon execution of _e_x_e_c. FFFF____SSSSEEEETTTTFFFFDDDD Set the file descriptor flags for _f_i_l_d_e_s. Currently the only flag implemented is FFFFDDDD____CCCCLLLLOOOOEEEEXXXXEEEECCCC. Note: this flag is a per- process and per-descriptor flag; setting or clearing it for a particular descriptor will not affect the flag on descriptors copied from it by a _d_u_p(2) or FFFF____DDDDUUUUPPPPFFFFDDDD operation, nor will it affect the flag on other processes instances of that descriptor. PPPPaaaaggggeeee 1111 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFF____GGGGEEEETTTTFFFFLLLL Get _f_i_l_e status flags and file access modes. The file access modes may be extracted from the return value using the mask OOOO____AAAACCCCCCCCMMMMOOOODDDDEEEE. FFFF____SSSSEEEETTTTFFFFLLLL Set _f_i_l_e status flags to the third argument, _a_r_g, taken as an object of type int. Only the following flags can be set [see _f_c_n_t_l(5)]: FFFFAAAAPPPPPPPPEEEENNNNDDDD, FFFFSSSSYYYYNNNNCCCC, DDDDSSSSYYYYNNNNCCCC, RRRRSSSSYYYYNNNNCCCC, FFFFNNNNDDDDEEEELLLLAAAAYYYY, FFFFNNNNOOOONNNNBBBBLLLLKKKK, FFFFLLLLCCCCFFFFLLLLUUUUSSSSHHHH, FFFFLLLLCCCCIIIINNNNVVVVAAAALLLL, FFFFDDDDIIIIRRRREEEECCCCTTTT, and FFFFAAAASSSSYYYYNNNNCCCC. Since _a_r_g is used as a bit vector to set the flags, values for all the flags must be specified in _a_r_g. (Typically, _a_r_g may be constructed by obtaining existing values by FFFF____GGGGEEEETTTTFFFFLLLL and then changing the particular flags.) FFFFAAAAPPPPPPPPEEEENNNNDDDD is equivalent to OOOO____AAAAPPPPPPPPEEEENNNNDDDD; FFFFSSSSYYYYNNNNCCCC is equivalent to OOOO____SSSSYYYYNNNNCCCC; FFFFDDDDSSSSYYYYNNNNCCCC is equivalent to OOOO____DDDDSSSSYYYYNNNNCCCC; FFFFRRRRSSSSYYYYNNNNCCCC is equivalent to OOOO____RRRRSSSSYYYYNNNNCCCC; FFFFNNNNDDDDEEEELLLLAAAAYYYY is equivalent to OOOO____NNNNDDDDEEEELLLLAAAAYYYY; FFFFNNNNOOOONNNNBBBBLLLLKKKK is equivalent to OOOO____NNNNOOOONNNNBBBBLLLLOOOOCCCCKKKK; FFFFLLLLCCCCFFFFLLLLUUUUSSSSHHHH is equivalent to OOOO____LLLLCCCCFFFFLLLLUUUUSSSSHHHH; FFFFLLLLCCCCIIIINNNNVVVVAAAALLLL is equivalent to OOOO____LLLLCCCCIIIINNNNVVVVAAAALLLL; and FFFFDDDDIIIIRRRREEEECCCCTTTT is equivalent to OOOO____DDDDIIIIRRRREEEECCCCTTTT. FFFFAAAASSSSYYYYNNNNCCCC is equivalent to calling _i_o_c_t_l with the FFFFIIIIOOOOAAAASSSSYYYYNNNNCCCC command (except that with _i_o_c_t_l all flags need not be specified). This enables the SSSSIIIIGGGGIIIIOOOO facilities and is currently supported only on sockets. Since the descriptor status flags are shared with descriptors copied from a given descriptor by a _d_u_p(2) or FFFF____DDDDUUUUPPPPFFFFDDDD operation, and by other processes instances of that descriptor a FFFF____SSSSEEEETTTTFFFFLLLL operation will affect those other descriptors and other instances of the given descriptors as well. For example, setting or clearing the FFFFNNNNDDDDEEEELLLLAAAAYYYY flag will logically cause an FFFFIIIIOOOONNNNBBBBIIIIOOOO _i_o_c_t_l(2) to be performed on the object referred to by that descriptor. Thus all descriptors referring to that object will be affected. Flags not understood for a particular descriptor are silently ignored except for FFFFDDDDIIIIRRRREEEECCCCTTTT. FFFFDDDDIIIIRRRREEEECCCCTTTT will return _E_I_N_V_A_L if used on other than an EFS, XFS or BDS file system file. FFFF____FFFFRRRREEEEEEEESSSSPPPP Alter storage space associated with a section of the ordinary file _f_i_l_d_e_s. The section is specified by a variable of data type _s_t_r_u_c_t _f_l_o_c_k pointed to by the third argument _a_r_g. The data type _s_t_r_u_c_t _f_l_o_c_k is defined in the <_f_c_n_t_l._h> header file [see _f_c_n_t_l(5)] and contains the following members: _l__w_h_e_n_c_e is 0, 1, or 2 to indicate that the relative offset _l__s_t_a_r_t will be measured from the start of the file, the current position, or the end of the file, respectively. _l__s_t_a_r_t is the offset from the position specified in _l__w_h_e_n_c_e. _l__l_e_n is the size of the section. An _l__l_e_n of 0 frees up to the end of the file; in this case, the end of file (i.e., file size) is set to the beginning of the section freed. Any data previously written into this section is no longer accessible. If the section specified is beyond the current end of file, the file is grown and filled with zeroes. The _l__l_e_n field is currently ignored, and should be set to 0. PPPPaaaaggggeeee 2222 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFF____AAAALLLLLLLLOOOOCCCCSSSSPPPP This command is identical to FFFF____FFFFRRRREEEEEEEESSSSPPPP. FFFF____FFFFRRRREEEEEEEESSSSPPPP66664444 This command is identical to FFFF____FFFFRRRREEEEEEEESSSSPPPP except that the type of the data referred to by the third argument _a_r_g is a _s_t_r_u_c_t _f_l_o_c_k_6_4. In this version of the structure, _l__s_t_a_r_t and _l__l_e_n are of type ooooffffffff66664444____tttt instead of ooooffffffff____tttt (64 bits instead of 32 bits). FFFF____AAAALLLLLLLLOOOOCCCCSSSSPPPP66664444 This command is identical to FFFF____FFFFRRRREEEEEEEESSSSPPPP66664444. FFFF____FFFFSSSSSSSSEEEETTTTDDDDMMMM Set the _d_i__d_m_e_v_m_a_s_k and _d_i__d_m_s_t_a_t_e fields in an XFS on-disk inode. The only legitimate values for these fields are those previously returned in the _b_s__d_m_e_v_m_a_s_k and _b_s__d_m_s_t_a_t_e fields of the _b_u_l_k_s_t_a_t structure. The data referred to by the third argument _a_r_g is a _s_t_r_u_c_t _f_s_d_m_i_d_a_t_a. This structure's members are _f_s_d__d_m_e_v_m_a_s_k and _f_s_d__d_m_s_t_a_t_e. The _d_i__d_m_e_v_m_a_s_k field is set to the value in _f_s_d__d_m_e_v_m_a_s_k. The _d_i__d_m_s_t_a_t_e field is set to the value in _f_s_d__d_m_s_t_a_t_e. This command is restricted to root or to processes with device management capabilities. Its sole purpose is to allow backup and restore programs to restore the aforementioned critical on-disk inode fields. FFFF____DDDDIIIIOOOOIIIINNNNFFFFOOOO Get information required to perform direct I/O on the specified _f_i_l_d_e_s. Direct I/O is performed directly to and from a user's data buffer. Since the kernels buffer cache is no longer between the two, the user's data buffer must conform to the same type of constraints as required for accessing a raw disk partition. The third argument, _a_r_g, points to a data type _s_t_r_u_c_t _d_i_o_a_t_t_r which is defined in the <_f_c_n_t_l._h> header file and contains the following members: _d__m_e_m is the memory alignment requirement of the user's data buffer. _d__m_i_n_i_o_s_z specifies block size, minimum I/O request size, and I/O alignment. The size of all I/O requests must be a multiple of this amount and the value of the seek pointer at the time of the I/O request must also be an integer multiple of this amount. _d__m_a_x_i_o_s_z is the maximum I/O request size which can be performed on the _f_i_l_d_e_s. If an I/O request does not meet these constraints, the _r_e_a_d(2) or _w_r_i_t_e(2) will return with _E_I_N_V_A_L. All I/O requests are kept consistent with any data brought into the cache with an access through a non-direct I/O file descriptor. See also FFFF____SSSSEEEETTTTFFFFLLLL above and _o_p_e_n (2). FFFF____GGGGEEEETTTTOOOOWWWWNNNN Used by sockets: get the process ID or process group currently receiving SSSSIIIIGGGGIIIIOOOO and SSSSIIIIGGGGUUUURRRRGGGG signals; process groups are returned as negative values. FFFF____SSSSEEEETTTTOOOOWWWWNNNN Used by sockets: set the process or process group to receive SIGIO and SIGURG signals; process groups are specified by supplying _a_r_g as negative, otherwise _a_r_g is interpreted as a process ID. PPPPaaaaggggeeee 3333 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFF____FFFFSSSSGGGGEEEETTTTXXXXAAAATTTTTTTTRRRR Get extended attributes associated with files in XFS file systems. The _a_r_g points to a variable of type _s_t_r_u_c_t _f_s_x_a_t_t_r. The structure fields include: _f_s_x__x_f_l_a_g_s (extended flag bits), _f_s_x__e_x_t_s_i_z_e (nominal extent size in file system blocks), _f_s_x__n_e_x_t_e_n_t_s (number of data extents in the file), _f_s_x__u_u_i_d (file unique id). Currently the only meaningful bits for the _f_s_x__x_f_l_a_g_s field are bit 0 (value 1), which if set means the file is a realtime file, and bit 1 (value 2), which if set means the file has preallocated space. A _f_s_x__e_x_t_s_i_z_e value returned indicates that a preferred extent size was previously set on the file, a _f_s_x__e_x_t_s_i_z_e of 0 indicates that the defaults for that filesystem will be used. FFFF____FFFFSSSSGGGGEEEETTTTXXXXAAAATTTTTTTTRRRRAAAA Identical to FFFF____FFFFSSSSGGGGEEEETTTTXXXXAAAATTTTTTTTRRRR except that the _f_s_x__n_e_x_t_e_n_t_s field contains the number of attribute extents in the file. FFFF____FFFFSSSSSSSSEEEETTTTXXXXAAAATTTTTTTTRRRR Set extended attributes associated with files in XFS file systems. The _a_r_g points to a variable of type _s_t_r_u_c_t _f_s_x_a_t_t_r, but only the following fields are used in this call: _f_s_x__x_f_l_a_g_s and _f_s_x__e_x_t_s_i_z_e. The _f_s_x__x_f_l_a_g_s realtime file bit, and the file's extent size, may be changed only when the file is empty. FFFF____GGGGEEEETTTTBBBBMMMMAAAAPPPP Get the block map for a segment of a file in an XFS file system. The _a_r_g points to an array of variables of type _s_t_r_u_c_t _g_e_t_b_m_a_p. All sizes and offsets in the structure are in units of 512 bytes. The structure fields include: _b_m_v__o_f_f_s_e_t (file offset of segment), _b_m_v__b_l_o_c_k (starting block of segment), _b_m_v__l_e_n_g_t_h (length of segment), _b_m_v__c_o_u_n_t (number of array entries, including the first), and _b_m_v__e_n_t_r_i_e_s (number of entries filled in). The first structure in the array is a header, and the remaining structures in the array contain block map information on return. The header controls iterative calls to the FFFF____GGGGEEEETTTTBBBBMMMMAAAAPPPP command. The caller fills in the _b_m_v__o_f_f_s_e_t and _b_m_v__l_e_n_g_t_h fields of the header to indicate the area of interest in the file, and fills in the _b_m_v__c_o_u_n_t field to indicate the length of the array. If the _b_m_v__l_e_n_g_t_h value is set to -1 then the length of the interesting area is the rest of the file. On return from a call, the header is updated so that the command can be used again to obtain more information, without re-initializing the structures. Also on return, the _b_m_v__e_n_t_r_i_e_s field of the header is set to the number of array entries actually filled in. The non-header structures will be filled in with _b_m_v__o_f_f_s_e_t, _b_m_v__b_l_o_c_k, and _b_m_v__l_e_n_g_t_h. If a region of the file has no blocks (is a hole in the file) then the _b_m_v__b_l_o_c_k field is set to -1. PPPPaaaaggggeeee 4444 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFF____GGGGEEEETTTTBBBBMMMMAAAAPPPPAAAA Identical to FFFF____GGGGEEEETTTTBBBBMMMMAAAAPPPP except that information about the attribute fork of the file is returned. FFFF____RRRREEEESSSSVVVVSSSSPPPP This command is used to allocate space to a file. A range of bytes is specified with the _s_t_r_u_c_t _f_l_o_c_k. The blocks are allocated, but not zeroed, and the file size does not change. It is only supported on XFS and BDS filesystems. If the XFS filesystem is configured to flag unwritten file extents, performance will be negatively affected when writing to preallocated space, since extra filesystem transactions are required to convert extent flags on the range of the file written. If _x_f_s__g_r_o_w_f_s(1M) with the -n option reports unwritten=1, then the filesystem was made to flag unwritten extents. Only the root user is permitted to execute _x_f_s__g_r_o_w_f_s(1M). FFFF____RRRREEEESSSSVVVVSSSSPPPP66664444 This command is identical to FFFF____RRRREEEESSSSVVVVSSSSPPPP except that the type of the data referred to by the third argument _a_r_g is a _s_t_r_u_c_t _f_l_o_c_k_6_4. In this version of the structure, _l__s_t_a_r_t and _l__l_e_n are of type ooooffffffff66664444____tttt instead of ooooffffffff____tttt (64 bits instead of 32 bits). FFFF____UUUUNNNNRRRREEEESSSSVVVVSSSSPPPP This command is used to free space from a file. A range of bytes is specified with the _s_t_r_u_c_t _f_l_o_c_k. Partial filesystem blocks are zeroed, and whole filesystem blocks are removed from the file. The file size does not change. It is only supported on XFS and BDS filesystems. FFFF____UUUUNNNNRRRREEEESSSSVVVVSSSSPPPP66664444 This command is identical to FFFF____UUUUNNNNRRRREEEESSSSVVVVSSSSPPPP except that the type of the data referred to by the third argument _a_r_g is a _s_t_r_u_c_t _f_l_o_c_k_6_4. In this version of the structure, _l__s_t_a_r_t and _l__l_e_n are of type ooooffffffff66664444____tttt instead of ooooffffffff____tttt (64 bits instead of 32 bits). FFFF____FFFFSSSSYYYYNNNNCCCC fsync data in a range of an ordinary file _f_i_l_d_e_s. The section is specified by a variable of data type _s_t_r_u_c_t _f_l_o_c_k pointed to by the third argument _a_r_g. The data type _s_t_r_u_c_t _f_l_o_c_k is defined in the <_f_c_n_t_l._h> header file [see _f_c_n_t_l(5)]. If field _l__t_y_p_e is set to 1, the call behaves like fdatasync(2). If field _l__t_y_p_e is set to 0, the call behaves like fsync(2). fdatasync(2) syncs only the inode state required to ensure that the data is permanently on the disk. fsync(2) syncs everything that fdatasync(2) flushes but also syncs out the other state associated with the file such as the current timestamps, permissions, owner, etc. _l__s_t_a_r_t specifies the start of the range in the file to be sync'ed. _l__l_e_n specifies the size of the range. A _l__l_e_n of 0 flushes everything up to the end of the file. The remaining fields are ignored and should be set PPPPaaaaggggeeee 5555 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) to 0. FFFF____FFFFSSSSYYYYNNNNCCCC66664444 This command is identical to FFFF____FFFFSSSSYYYYNNNNCCCC except that the type of the data referred to by the third argument _a_r_g is a _s_t_r_u_c_t _f_l_o_c_k_6_4. In this version of the structure, _l__s_t_a_r_t and _l__l_e_n are of type ooooffffffff66664444____tttt instead of ooooffffffff____tttt (64 bits instead of 32 bits). FFFF____GGGGEEEETTTTBBBBIIIIOOOOSSSSIIIIZZZZEEEE This command gets information about the preferred buffered I/O size used by the system when performing buffered I/O (e.g. standard Unix non-direct I/O) to and from the file. The information is passed back in a structure of type _s_t_r_u_c_t _b_i_o_s_i_z_e pointed to by the third argument _a_r_g. The data type _s_t_r_u_c_t _b_i_o_s_i_z_e is defined in the <_f_c_n_t_l._h> header file [see _f_c_n_t_l(5)]. biosize lengths are expressed in log base 2. That is if the value is 14, then the true size is 2^14 (2 raised to the 14th power). The biosz_read field will contain the current value used by the system when reading from the file. Except at the end-of-file, the system will read from the file in multiples of this length. The biosz_write field will contain the current value used by the system when writing to the file. Except at the end-of-file, the system will write to the file in multiples of this length. The dfl_biosz_read and dfl_biosz_write will be set to the system default values for the opened file. The biosz_flags field will be set to 1 if the current read or write value has been explicitly set. The FFFF____GGGGEEEETTTTBBBBIIIIOOOOSSSSIIIIZZZZEEEE fcntl is supported only on XFS filesystems. FFFF____SSSSEEEETTTTBBBBIIIIOOOOSSSSIIIIZZZZEEEE This command the preferred buffered I/O size used by the system when performing buffered I/O (e.g. standard Unix non-direct I/O) to and from the file. The information is passed in a structure of type _s_t_r_u_c_t _b_i_o_s_i_z_e pointed to by the third argument _a_r_g. Using smaller preferred I/O sizes can result in performance improvements if the file is typically accessed using small synchronous I/Os or if only a small amount of the file is accessed using small random I/Os, resulting in little or no use of the additional data read in near the random I/Os. To explicitly set the preferred I/O sizes, the biosz_flags field should be set to 0 and the biosz_read and biosz_write fields should be set to the log base 2 of the desired read and write lengths, respectively (e.g. 13 for 8K bytes, 14 for 16K bytes, 15 for 32K bytes, etc.). Valid values are 13-16 inclusive for machines with a 4K byte pagesize and 14-16 for machines with a 16K byte pagesize. The specified read and write values must also result in lengths that are greater than or equal to the filesystem block size. The dfl_biosz_read and dfl_biosz_write fields are ignored. If biosizes have already been explicitly set due to a prior use PPPPaaaaggggeeee 6666 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) of FFFF____SSSSEEEETTTTBBBBIIIIOOOOSSSSIIIIZZZZEEEE, and the requested sizes are larger then the existing sizes, the fcntl call will return successfully and the system will use the smaller of the two sizes. However, if biosz_flags is set to 1, the system will use the new values regardless of whether the new sizes are larger or smaller than the old. To reset the biosize values to the defaults for the filesystem that the file resides in, the biosz_flags filed should be set to 2. The remainder of the fields will be ignored in that case. Changes made by FFFF____SSSSEEEETTTTBBBBIIIIOOOOSSSSIIIIZZZZEEEE are transient. The sizes are reset to the default values once the reference count on the file drops to zero (e.g. all open file descriptors to that file have been closed). See _f_s_t_a_b(4) for details on how to set the default biosize values for a filesystem. The FFFF____SSSSEEEETTTTBBBBIIIIOOOOSSSSIIIIZZZZEEEE fcntl is supported only on XFS filesystems. The following commands are used for record-locking. Locks may be placed on an entire file or on segments of a file. FFFF____GGGGEEEETTTTLLLLKKKK Get the first lock which blocks the lock description given by the variable of type _s_t_r_u_c_t _f_l_o_c_k pointed to by _a_r_g. The information retrieved overwrites the information passed to _f_c_n_t_l in the _f_l_o_c_k structure. If no lock is found that would prevent this lock from being created, then the structure is passed back unchanged except that the lock type will be set to FFFF____UUUUNNNNLLLLCCCCKKKK and the _l__w_h_e_n_c_e field will be set to SSSSEEEEEEEEKKKK____SSSSEEEETTTT. If a lock is found that would prevent this lock from being created, then the structure is overwritten with a description of the first lock that is preventing such a lock from being created. The returned structure will also contain the process ID and the system ID of the process holding the lock. This command never creates a lock; it tests whether a particular lock could be created. FFFF____SSSSEEEETTTTLLLLKKKK Set or clear a file segment lock according to the variable of type _s_t_r_u_c_t _f_l_o_c_k pointed to by _a_r_g [see _f_c_n_t_l(5)]. The _c_m_d FFFF____SSSSEEEETTTTLLLLKKKK is used to establish read (F_RDLCK) and write (F_WRLCK) locks, as well as remove either type of lock (F_UNLCK). If a read or write lock cannot be set _f_c_n_t_l will return immediately with an error value of -1. FFFF____SSSSEEEETTTTLLLLKKKKWWWW This _c_m_d is the same as FFFF____SSSSEEEETTTTLLLLKKKK except that if a read or write lock is blocked by other locks, the process will sleep until the segment is free to be locked. FFFF____GGGGEEEETTTTLLLLKKKK66664444 This _c_m_d is identical to FFFF____GGGGEEEETTTTLLLLKKKK but uses a _s_t_r_u_c_t _f_l_o_c_k_6_4 instead of a _s_t_r_u_c_t _f_l_o_c_k (see FFFF____FFFFRRRREEEEEEEESSSSPPPP66664444 above). PPPPaaaaggggeeee 7777 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFF____SSSSEEEETTTTLLLLKKKK66664444 This _c_m_d is identical to FFFF____SSSSEEEETTTTLLLLKKKK but uses a _s_t_r_u_c_t _f_l_o_c_k_6_4 instead of a _s_t_r_u_c_t _f_l_o_c_k. FFFF____SSSSEEEETTTTLLLLKKKKWWWW66664444 This _c_m_d is identical to FFFF____SSSSEEEETTTTLLLLKKKKWWWW but uses a _s_t_r_u_c_t _f_l_o_c_k_6_4 instead of a _s_t_r_u_c_t _f_l_o_c_k. FFFF____SSSSEEEETTTTBBBBSSSSDDDDLLLLKKKK This _c_m_d is identical to FFFF____SSSSEEEETTTTLLLLKKKK and provided for the backward compatibility only. Newer applications should use FFFF____SSSSEEEETTTTLLLLKKKK instead. FFFF____SSSSEEEETTTTBBBBSSSSDDDDLLLLKKKKWWWW This _c_m_d is identical to FFFF____SSSSEEEETTTTLLLLKKKKWWWW and provided for the backward compatibility only. Newer applications should use FFFF____SSSSEEEETTTTLLLLKKKKWWWW instead. FFFF____RRRRSSSSEEEETTTTLLLLKKKK Used by the network lock daemon, _l_o_c_k_d(3N), to communicate with the NFS server kernel to handle locks on NFS files. FFFF____RRRRSSSSEEEETTTTLLLLKKKKWWWW Used by the network lock daemon, _l_o_c_k_d(3N), to communicate with the NFS server kernel to handle locks on NFS files. FFFF____RRRRGGGGEEEETTTTLLLLKKKK Used by the network lock daemon, _l_o_c_k_d(3N), to communicate with the NFS server kernel to handle locks on NFS files. FFFF____CCCCHHHHKKKKFFFFLLLL This flag is used internally by FFFF____SSSSEEEETTTTFFFFLLLL to check the legality of file flag changes. A read lock prevents any process from write locking the protected area. More than one read lock may exist for a given segment of a file at a given time. The file descriptor on which a read lock is being placed must have been opened with read access. A write lock prevents any process from read locking or write locking the protected area. Only one write lock and no read locks may exist for a given segment of a file at a given time. The file descriptor on which a write lock is being placed must have been opened with write access. The structure _f_l_o_c_k describes the type (_l__t_y_p_e), starting offset (_l__w_h_e_n_c_e), relative offset (_l__s_t_a_r_t), size (_l__l_e_n), process id (_l__p_i_d), and system id (_l__s_y_s_i_d) of the segment of the file to be affected. The process id and system id fields are used only with the FFFF____GGGGEEEETTTTLLLLKKKK _c_m_d to return the values for a blocking lock. Locks may start and extend beyond the current end of a file, but may not be negative relative to the beginning of the file. A lock may be set to always extend to the end of file by setting _l__l_e_n to zero (0). If such a lock also has _l__w_h_e_n_c_e and _l__s_t_a_r_t set to zero (0), the whole file will be locked. Changing or unlocking a segment from the middle of a larger locked segment leaves two smaller segments for either end. Locking a segment that is already locked by the calling process causes the old lock type to be removed and the new lock type to take effect. All locks associated with a file for a PPPPaaaaggggeeee 8888 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) given process are removed when a file descriptor for that file is closed by that process or the process holding that file descriptor terminates. Locks are not inherited by a child process in a _f_o_r_k(2) system call. When file locking is used in conjunction with memory-mapped files over NFS, the smallest locking granularity which will work properly with multiple clients is the page size of the system. All clients must use the same granularity. When mandatory file and record locking is active on a file, [see _c_h_m_o_d(2)], _r_e_a_d(_2), _c_r_e_a_t(_2), _o_p_e_n(_2), and _w_r_i_t_e(_2) system calls issued on the file will be affected by the record locks in effect. The following commands are used for SMB opportunistic locks. An SMB server application will register oplocks on files and grant them to SMB clients. When external references are made to oplocked files, the SMB server is notified to revoke the oplocks granted to clients before operations from the external references are allowed to continue. FFFF____OOOOPPPPLLLLKKKKRRRREEEEGGGG The oplock registration command identifies the file to oplock and, via _a_r_g, the write side of the pipe (e.g. p[1] from the pipe(int *p) call) to use as the signaling mechanism. The same write side pipe can be used for any number of oplocked files. If any external references to the file already exist or the caller already has an oplock on the file, the FFFF____OOOOPPPPLLLLKKKKRRRREEEEGGGG command fails with _E_A_G_A_I_N. If successful, the value of OOOOPPPP____EEEEXXXXCCCCLLLLUUUUSSSSIIIIVVVVEEEE is returned. FFFF____OOOOPPPPLLLLKKKKSSSSTTTTAAAATTTT The oplock state change command is used to get state change information on any recently externally referenced files registered with the given write side pipe (eg p[1] from a pipe(int *p) call). The returned _o_p_l_o_c_k__s_t_a_t__t structure pointed at by _a_r_g contains the current state (_o_s__s_t_a_t_e) and the dev/ino information (_o_s__d_e_v/_o_s__i_n_o) to identify the file. This is only done on the write side of a pipe for which select() indicates there is a byte of data to read() on the read side. A byte of data must then be read() from the read side of the pipe for each successful FFFF____OOOOPPPPLLLLKKKKSSSSTTTTAAAATTTT run on the write side for select() to again give proper notification. External references that cause state change notification will hang for a while until the SMB server acknowledges the revocation (typically after revoking the oplock it granted to the SMB client) or until the systunable oplock_timeout expires. FFFF____OOOOPPPPLLLLKKKKAAAACCCCKKKK The oplock acknowledgement command is primarily used to respond to oplock state changes due to external references on the given file. The value given by _a_r_g can be OOOOPPPP____RRRREEEEVVVVOOOOKKKKEEEE to revoke the oplock either voluntarily or as an acknowledgement of a state PPPPaaaaggggeeee 9999 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) change reported in an FFFF____OOOOPPPPLLLLKKKKSSSSTTTTAAAATTTT command, or it can be -1 to request the current state of the given file. If FFFF____OOOOPPPPLLLLKKKKAAAACCCCKKKK is not used to voluntarily revoke the oplock, the oplock is automatically revoked on the SMB server's last close() of the file. If FFFF____OOOOPPPPLLLLKKKKAAAACCCCKKKK is not used to revoke the oplock in response to a state change indicated in an FFFF____OOOOPPPPLLLLKKKKSSSSTTTTAAAATTTT command, the oplock is automatically revoked when the oplock_timeout expires. _f_c_n_t_l will fail if one or more of the following are true: [EACCES] _c_m_d is F_SETLK, the type of lock (_l__t_y_p_e) is a read lock ( F_RDLCK, ) and the segment of a file to be lock is already write locked by another process, or the type is a write lock ( F_WRLOCK, ) and the segment of a file to be locked in already read or write locked by another process. [EBADF] _F_i_l_d_e_s is not a valid open file descriptor. [EBADF] _c_m_d is F_SETLK, or SETLKW, the type of lock (_l__t_y_p_e) is a read lock (F_RDLCK), and _f_i_l_d_e_s is not a valid file descriptor open for reading. [EBADF] _c_m_d is F_SETLK, or SETLKW, the type of lock (_l__t_y_p_e) is a write lock (F_WRLCK), and _f_i_l_d_e_s is not a valid file descriptor open for writing. [EBADF] _c_m_d is F_FREESP and _f_i_l_d_e_s is not a valid file descriptor open for writing. [EBADF] _c_m_d is F_OPLOCKREG and the file is not a regular file or the _a_r_g is not the write side of a pipe. [EMFILE] _c_m_d is F_DUPFD and {_O_P_E_N__M_A_X} file descriptors are currently in use by this process, or no file descriptors greater than or equal to _a_r_g are available. [EINVAL] _c_m_d is F_DUPFD. _a_r_g is either negative, or greater than or equal to the maximum number of open file descriptors allowed each user [see _g_e_t_d_t_a_b_l_e_s_i_z_e(2)]. [EINVAL] _c_m_d is F_GETLK, F_SETLK, or F_SETLKW and _a_r_g or the data it points to is not valid. [EINVAL] _c_m_d is F_SETFL, _a_r_g includes _F_D_I_R_E_C_T and is being performed on other than an EFS, XFS or BDS file system file. PPPPaaaaggggeeee 11110000 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) [EINVAL] _c_m_d is F_SETBIOSIZE and _a_r_g is invalid. [EINVAL] _c_m_d is F_OPLKREG and _f_i_l_d_e_s is a file in a filesystem other than XFS. Kernel level oplocks are only supported for XFS. [EINVAL] _c_m_d is F_OPLKACK and the _a_r_g is not OOOOPPPP____RRRREEEEVVVVOOOOKKKKEEEE or -1. [EAGAIN] _c_m_d is F_FREESP , the file exists, mandatory file/record locking is set, and there are outstanding record locks on the file. This restriction is not currently enforced. [EAGAIN] _c_m_d is F_SETLK or F_SETLKW , mandatory file locking bit is set for the file, and the file is currently being mapped to virtual memory via _m_m_a_p [see _m_m_a_p(2)]. This restriction is not currently enforced. [EAGAIN] _c_m_d is F_OPLKREG and there is more than one reference on the file. Oplocks thus cannot be used to guarantee exclusive access to the file. [EAGAIN] _c_m_d is F_OPLKSTAT and there are no state change messages for the specified write side pipe. [EPERM] _c_m_d is F_OPLKREG or F_OPLKSTAT or F_OPLKACK and the user is not superuser. [ENOLCK] _c_m_d is F_SETLK or F_SETLKW, the type of lock is a read or write lock, and there are no more record locks available (too many file segments locked) because the system maximum {_F_L_O_C_K__M_A_X} [see _i_n_t_r_o(2)], has been exceeded. This can also occur if the object of the lock resides on a remote system and the requisite locking daemons are not configured in both the local and the remote systems. In particular, if _llll_oooo_cccc_kkkk_dddd(1M) is running but _ssss_tttt_aaaa_tttt_dddd(1M) is not, this error will be returned. An additional source for this error is when _ssss_tttt_aaaa_tttt_dddd(1M) is running but cannot be contacted. This can occur when the address for the local host cannot be determined. [See _llll_oooo_cccc_kkkk_dddd(1M) and _ssss_tttt_aaaa_tttt_dddd(1M).] [EINTR] _c_m_d is F_SETLKW and a signal interrupted the process while it was waiting for the lock to be granted. [EDEADLK] _c_m_d is F_SETLKW, the lock is blocked by some lock from another process, and putting the calling-process to sleep, waiting for that lock to become free, would cause a deadlock. [EDEADLK] _c_m_d is F_FREESP, mandatory record locking is enabled, O_NDELAY and O_NONBLOCK are being clear and a deadlock condition was detected. PPPPaaaaggggeeee 11111111 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) [EFAULT] _c_m_d is F_FREESP, and the value pointed to by the third argument _a_r_g resulted in an address outside the process's allocated address space. [EFAULT] _c_m_d is F_GETLK, F_SETLK or F_SETLKW, and _a_r_g points outside the program address space. [ESRCH] _c_m_d is F_SETOWN and no process can be found corresponding to that specified by _a_r_g. [EIO] An I/O error occurred while reading from or writing to the file system. [EOVERFLOW] _c_m_d is F_GETLK and the process ID of the process holding the requested lock is too large to be stored in the _l__p_i_d field. [ETIMEDOUT] The object of the fcntl is located on a remote system which is not available [see _iiii_nnnn_tttt_rrrr_oooo(2)]. SSSSEEEEEEEE AAAALLLLSSSSOOOO lockd(1M), close(2), creat(2), dup(2), exec(2), fork(2), getdtablesize(2), intro(2), open(2), pipe(2), fcntl(5). DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS Upon successful completion, the value returned depends on _c_m_d as follows: F_DUPFD A new file descriptor. F_GETFD Value of flag (only the low-order bit is defined). F_SETFD Value other than -1. F_GETFL Value of file flags. F_SETFL Value other than -1. F_FREESP Value of 0. F_ALLOCSP Value of 0. F_FREESP64 Value of 0. F_ALLOCSP64 Value of 0. F_DIOINFO Value of 0. F_GETOWN _p_i_d of socket owner. F_SETOWN Value other than -1. F_FSGETXATTR Value of 0. F_FSSETXATTR Value of 0. F_GETBMAP Value of 0. F_RESVSP Value of 0. F_RESVSP64 Value of 0. F_UNRESVSP Value of 0. PPPPaaaaggggeeee 11112222 FFFFCCCCNNNNTTTTLLLL((((2222)))) FFFFCCCCNNNNTTTTLLLL((((2222)))) F_UNRESVSP64 Value of 0. F_GETLK Value other than -1. F_SETLK Value other than -1. F_SETLKW Value other than -1. F_GETLK64 Value other than -1. F_SETLK64 Value other than -1. F_SETLKW64 Value other than -1. Otherwise, a value of -1 is returned and _e_r_r_n_o is set to indicate the error. PPPPaaaaggggeeee 11113333